'use strict'

module.exports = {
  async up(queryInterface, Sequelize) {
    const { STRING, INTEGER, DATE, TEXT, BOOLEAN } = Sequelize
    await queryInterface.createTable('upkeep', {
      id: {
        type: INTEGER(10).UNSIGNED,
        allowNull: false,
        autoIncrement: true,
        primaryKey: true,
        comment: '主键id'
      },
      title: {
        type: STRING(255),
        allowNull: false,
        comment: '标题'
      },
      desc: {
        type: TEXT,
        allowNull: false,
        comment: '描述'
      },
      poster: {
        type: STRING(255),
        allowNull: false,
        comment: '海报'
      },
      status: {
        type: BOOLEAN,
        allowNull: false,
        defaultValue: 1,
        comment: '状态 0:禁用 1:启用'
      },
      content: {
        type: TEXT,
        allowNull: false,
        comment: '内容'
      },
      created_at: DATE,
      updated_at: DATE
    })
  },

  async down(queryInterface) {
    queryInterface.dropTable('upkeep')
  }
}
